#include <tinyxml.h>
#include "../../include/Tileset/tilesetImage.hpp"

namespace Tmx{

Image::Image() 
{
	width = 0;
	height = 0;
}

Image::~Image()
{
	//std::cout << "image destructor called\n";
}

void Image::parse(const TiXmlNode *imageNode)
{
  const TiXmlElement *imageElement = imageNode->ToElement();
  source = imageElement->Attribute("source");
  imageElement->Attribute("width", &width);
  imageElement->Attribute("height",&height);
  const char *tc = imageElement->Attribute("trans");
  if (tc){
	  trans = tc;
  }
  if (!tileTexture.loadFromFile(source))
	  std::cout << "Error loading tile texture\n";
  tileSprite.setTexture(tileTexture);
}

}; // namespace Tmx
